﻿using AutoMapper;
using BLL.Interface;
using BLL.Model;
using DAL.Engine.Domain;
using System;

namespace BLL
{
    public class EntityMapper : IEntityMapper
    {
        public EntityMapper()
        {
            Mapper.Initialize(cfg =>
            {
                cfg.CreateMap<User, UserModel>();
            });
            Mapper.AssertConfigurationIsValid();
        }

        /// <summary>
        /// Execute a mapping from the source object to a new destination object
        /// </summary>
        public TDestination Map<TSource, TDestination>(TSource source)
        {
            return Mapper.Map<TSource, TDestination>(source);
        }
    }
}
